import sys

class Solution:
    def cut_line(self, N, M, text):
        words = text.split()
        lines = []
        now_line = ''
        for word in words:
            last_c = word[-1]
            if last_c.isalpha():
                ow = word[:-1]
                oc = word[-1]
            else:
                ow, oc = word, ''
            new_line = now_line + ' ' + ow if len(now_line) != 0 else ow
            if len(new_line) <= N:
                now_line = new_line + oc
                continue
            if N < len(new_line) <= N+M:
                now_line = ''
                lines.append(new_line + oc)
                continue
            lines.append(now_line)
            now_line = ow + oc
        if len(now_line) != 0:
            lines.append(now_line)
        return lines


if __name__ == '__main__':
    # fp = sys.stdin
    fp = open('./netease3.in')
    N, M = map(int, fp.readline().split())
    s = Solution()
    lines = s.cut_line(N, M, fp.readline())
    print(len(lines))
    for line in lines:
        print(line)
